<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fck" uri="/WEB-INF/FCKeditor.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath() %>/css/Style.css" type="text/css" rel="stylesheet">
<link>
<script type="text/javascript" src="<%=request.getContextPath() %>/FCKeditor/fckeditor.js"></script>
<script type="text/javascript">
	function checkSubmit() {
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		var isError = false;
		if (title == "") {
			isError = true;
			document.getElementById("title_msg").innerHTML = "请输入新闻标题";
		}else if(title.length>100){
			isError=true;
			document.getElementById("title_msg").innerHTML = "标题长度不得超过100个字符";
		}
		if (content == "") {
			isError = true;
			document.getElementById("content_msg").innerHTML = "请输入新闻内容";
		}
		if(isError){
			return ;
			}
		document.getElementById("n_form").submit();
	}
</script>
</head>
<body>
<form  method="post" action="<%=request.getContextPath() %>/admin/editNews.htm" id="n_form">
<table border="0" cellspacing="0" cellpadding="0" class="thead" width="100%">
	<tr><td style="padding:3px;">当前位置:新闻修改</td></tr>
</table>
<input type="hidden" name="newsData.id" value="<s:property value="newsData.id"/>" id="newsid"/>
<input type="hidden" name="nodeid" value="<%=request.getParameter("nodeid") %>">
<table cellpadding="2" cellspacing="1" border="0" width="100%" align="center">
	<tr>
		<td colspan="3" align="center" style="color: red;font-weight: bold;"><s:actionmessage/></td>
	</tr>
	<tr>
		<td width="10%" align="right" class='td1' >新闻标题<font color='#FF0000'>*</font>：</td>
		<td width="80%" class='td1'><input name='newsData.title' type='text' size='40' id="title"  maxlength="100" value="<s:property value="newsData.title"/>"/></td>
		<td width="10%"><span id="title_msg" class="errorMessage"><s:fielderror fieldName="title"/></span></td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td width="10%" align="right" class='td1'>状态<font color='#FF0000'>*</font>：</td>
		<td width="80%" class='td1'><select name="newsData.status" id="status"><option value="0"  selected="selected">下线</option><option value="1" <s:if test="newsData.status==1">selected="selected"</s:if> >上线</option></select><span id="check2"></span></td>
		<td width="10%"><span id="status_msg" class="errorMessage"></span></td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td width="10%" align="right" class='td1'>文章摘要：</td>
		<td width="80%" class='td1'>
			<div style="width: 100%">
				<textarea name="newsData.summary" id="summary"  rows="3"  style="width:100%;height:100%;overflow-x:visible;overflow-y:visible;"><s:property value="newsData.summary"/></textarea>
			</div>
		</td>
		<td width="10%" ><span id="content_msg" class="errorMessage"><s:fielderror fieldName="content"/></span></td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td width="10%" align="right" class='td1'>文章内容<font color='#FF0000'>*</font>：</td>
		<td width="80%" class='td1'>
			<!--  <textarea name="newsData.content" id="content"><s:property value="newsData.content"/></textarea>-->
			<fck:editor id="newsData.content" height="300" width="100%">
				<s:property value="newsData.content" escape="false"/>
			</fck:editor>
		</td>
		<td width="10%" ><span id="content_msg" class="errorMessage"><s:fielderror fieldName="content"/></span></td>
	</tr>
	<tr align="center">
		<s:if test="method=='success'">
			<td colspan="3" class='td1'><input type="button" onclick="window.location.href='<%=request.getContextPath() %>/admin/getNews.htm?nodeid=${nodeid}'" value="确定"/></td>
		</s:if>
		<s:else>
		<td colspan="3" class='td1'><input type='button' value='修改' onclick="checkSubmit();"> <input type="button" value="返回" onclick="window.history.go(-1);";></td>
		</s:else>
	</tr>
</table>
</form>
<script type="text/javascript">
	window.onload = function() {
		//var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples'));
		//var oFCKeditor = new FCKeditor('newsData.content');
		//oFCKeditor.Width = '500';
		//oFCKeditor.Height = '300';
		//oFCKeditor.BasePath = "<%=request.getContextPath()%>/FCKeditor/";
		//oFCKeditor.ReplaceTextarea();
	};
</script>
</body>
</html>